package com.hunk.core.auth.repository;

import java.util.List;
import java.util.Set;

import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.hunk.core.auth.entity.UserRole;

/**
 * Description :<br>
 *  Data Access Object Interface
 * @author HunkDeng
 * @since 2013-4-27
 */
@Repository
public interface UserRoleRepository extends JpaRepository<UserRole, String>, JpaSpecificationExecutor<UserRole> {
	@Query(" from UserRole ur where ur.user.id = :userid")
	public List<UserRole> getUserRolesByUserId(@Param("userid") String userid);
	
	public final static Sort defaultSort = new Sort(new Sort.Order(Direction.DESC, "update_time"));
}
